package br.usp.pcs.basys2.event;

import java.util.Calendar;

import br.usp.pcs.basys2.BasysProcess;
import br.usp.pcs.basys2.engine.BasysSystem;
import br.usp.pcs.basys2.engine.Engine;
import br.usp.pcs.basys2.info.FileActivityInfo;

public class InterruptionForFileActivityEvent extends Event {

	private FileActivityInfo fileActivityInfo;
	
	public InterruptionForFileActivityEvent(BasysProcess process, Calendar dateOfArrival, FileActivityInfo fileActivityInfo) {
		super(process, dateOfArrival);
		this.fileActivityInfo = fileActivityInfo;
	}

	public FileActivityInfo getfileActivityInfo() {
		return fileActivityInfo;
	}

	@Override
	public void execute() {
		BasysSystem system = Engine.getInstance().getSystem();
		//system.getProcessorManager().interruptReached(this.getProcess());
		system.getFileManager().get(fileActivityInfo.getFileName()).requestAcess(getProcess(),fileActivityInfo);
	}
	

}
